<template>
  <el-select
    v-model="assetList"
    multiple
    collapse-tags
    style="margin-left: 20px"
    placeholder="请选择"
    @change="assetChange()"
  >
    <el-option
      v-for="asset in options.assets"
      :key="asset.id"
      :label="asset.name"
      :value="asset.id"
    >
    </el-option>
  </el-select>
</template>

<script>
export default {
  data() {
    return {
      options: {},
      assetList: [],
    };
  },

  methods: {
    assetChange() {
      // console.log(this.assetList);
      // console.log(window.location.href);
      const queryString = window.location.href.split("?")[1];
      // console.log(queryString);
      this.assetList.forEach((id) => {
        queryString += "&hotelasset=" + id;
      });
      // console.log(queryString);
    },
  },

  created() {
    this.$axios({
      url: "/hotels/options",
    }).then((res) => {
      // console.log(res.data.data);
      this.options = res.data.data;
    });
  },
};
</script>

<style>
</style>